<div id="tiga_ba">
	<div id="tiga_baa">Data PPK </div>
	<div id="tiga_bab">
		<a href="javascript:void(0)" onClick="location.href='utama.php?module=mod_ppk&view=form_tambah'">
			<button class="button">Tambah</button>
		</a>
	</div>
	<div class="clear"></div>
</div>

<?php
	if(!empty($_GET['nama'])){
		$param_nama=$_GET['nama'];
	}else{
		$param_nama=$_POST['nama'];
	}
?>
<form method=post action='utama.php?module=mod_ppk'>
	<table style="margin-left: 5px;" width="830" >
		<tr>
			<td width="65">Pencarian  : </td>
			<td width="200"><input type="text" name="nama" value="<?php echo $param_nama; ?>" class="input_field" /></td>
			<td><input name="submit" type="submit" class="button" value="Cari" /></td>
			<td></td>
			<td align="right"><a href="module/mod_ppk/cetak.php"><img src="asset/images/print.png" width="30"></a></td>
		</tr>
	</table>
</form>

<table class="tabel">
	<tr>
		<th>NO</th>
		<th>Aksi</th>
		<th width="90">Tarif</th>
		<th>Kode RS</th>
		<th>PPK</th>
		<th>Alamat</th>
		<th>Kls</th>
		<th>Direktur</th>
	</tr>
	<?php
		$p= new paging ;
		$batas= 10;

		//cek halaman dan posisi halaman
		$posisi = $p ->cariposisi($batas) ;
		$sql="select p.id_ppk,p.nama, j.jenis, p.alamat,k.kabupaten,kl.kelas,kt.kelas_tarif,p.direktur from ppk p inner join jenis_ppk j on p.id_jenis = j.id_jenis inner join kabupaten k on p.id_kabupaten = k.id_kabupaten inner join kelas kl on kl.id_kelas = p.id_kelas inner join kelas_tarif kt on kt.id_kelas_tarif = p.id_kelas_tarif where nama like '%$param_nama%' order by id_ppk desc limit $posisi,$batas";
		//echo $sql;
		$qry=mysql_query($sql);
		$no=$posisi + 1;
		if(mysql_num_rows($qry)>0){
		
			while($hasil=mysql_fetch_array($qry)){
	?>
				<tr>
					<td align="center" width="30"><?php echo $no;?></td>
					<td align="center" width="45">
						<a href="utama.php?module=mod_ppk&view=detail&id=<?php echo $hasil['id_ppk'];?>" ><img src="asset/images/detail.png" title="Detail"></a>
						<a href="utama.php?module=mod_ppk&view=copy&id=<?php echo $hasil['id_ppk'];?>">
						<img src="asset/images/copy.png" title="Copy Tarif"></a>
						<br>
						<a href="utama.php?module=mod_ppk&view=form_edit&id=<?php echo $hasil['id_ppk'];?>">
						<img src="asset/images/edit.png" title="Ubah Data"></a> 
						<a href="utama.php?module=mod_ppk&act=hapus&id=<?php echo $hasil['id_ppk'];?>" onclick="return confirm('Anda yakin ingin Menghapus Data ? Menghapus PPK jugas akan menghapus data tarif.')"><img src="asset/images/delete.png" title="Hapus Data"></a>
					</td>
					<td align="center">
						<a href="utama.php?module=mod_tarif_abhp&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/abhp.png" title="Tarif ABHP" width="16"></a> 
						<a href="utama.php?module=mod_tarif_obat&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/obat.png" title="Tarif Obat" width="16"></a>
						<a href="utama.php?module=mod_tarif_layanan&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/layanan.png" title="Tarif Layanan" width="16"></a>
						<a href="utama.php?module=mod_tarif_tindakan&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/tindakan.png" title="Tarif Tindakan" width="16"></a> 
						<br>
						<a href="utama.php?module=mod_tarif_laboratorium&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/lab.png" title="Tarif Laboratorium" width="16" /></a>
						<a href="utama.php?module=mod_tarif_radiologi&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/radiologi.png" title="Tarif Radiologi" width="16"></a>
						<a href="utama.php?module=mod_tarif_rehabilitasi&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/layanan.png" title="Tarif Rehabilitasi" width="16"></a>
						<a href="utama.php?module=mod_tarif_elektromedik&id_ppk=<?php echo $hasil['id_ppk'];?>"><img src="asset/images/layanan.png" title="Tarif Elektromedik" width="16"></a>
					</td>
					<td ><?php echo $hasil['id_ppk'];?></td>
					<td ><?php echo $hasil['nama'];?></td>
					<td ><?php echo $hasil['alamat'];?></td>
					<td ><?php echo $hasil['kelas'];?></td>
					<td ><?php echo $hasil['direktur'];?></td>
				</tr>
				
		<?php
				$no++;
			}
		}else{
		?>
	
	<tr>
		<td colspan="10" align="center">Data tidak Ada </td>
	</tr>
	
	<?php
		}
	?>
</table>

<?php
	$sql2="select * from ppk where nama like '%$param_nama%'" ;
	$query2=mysql_query($sql2);
	$jumlah_data=mysql_num_rows($query2);
	//dapatkan jumlah halaman
	$jumlah_halaman= $p->jumlahhalaman($jumlah_data,$batas);
	//cetak link
	$linkhalaman=$p->navhalaman($_GET['halaman'],$jumlah_halaman,$_SERVER['PHP_SELF']."?module=mod_ppk","nama=$param_nama");
	print($linkhalaman);
?>
        